package com.luocj.muke.demo.fragment;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.luocj.muke.demo.R;
import com.luocj.muke.demo.adapter.MyAdapter;

public class FragmentA extends BaseFragment {

    private static final String TAG = FragmentA.class.getSimpleName();
    private View inflate;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        inflate = inflater.inflate(R.layout.fragment_a, container, false);
        return inflate;
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        initView(inflate);
    }

    @Override
    protected void loadData() {
        Log.i(TAG, "loadData: ");
    }

    private void initView(View rootView) {
        RecyclerView recyclerview = rootView.findViewById(R.id.recyclerview);
        LinearLayoutManager manager = new LinearLayoutManager(getActivity());
        recyclerview.setLayoutManager(manager);
        MyAdapter adapter = new MyAdapter(getActivity());
        recyclerview.setAdapter(adapter);
    }

    @Override
    public void onResume() {
        super.onResume();
        Log.i(TAG, "onResume: ");
    }
}
